<script setup lang="ts">
import { onMounted } from 'vue';

import { customerInfo } from '#/api/hm/customer';
import { Description, useDescription } from '#/components/description';

import { descSchema } from '../info';

const props = defineProps({
  customerId: {
    type: String,
    default: '',
  },
});
const [registerDescription, { setDescProps }] = useDescription({
  column: 4,
  labelStyle: {
    minWidth: '150px',
    width: '150px',
  },
  schema: descSchema,
});

onMounted(async () => {
  handleOpenChange();
});
async function handleOpenChange() {
  const info = await customerInfo(props.customerId);

  // 赋值
  setDescProps({ data: info });
}
</script>

<template>
  <Description @register="registerDescription" />
</template>
